// 主界面

#include "head.h"
#include "ui_piano_key.h"

class UIMain : public UI::Scene
{
public:
	UIMain()
	{
		_allKey.resize(88);
		for(size_t i = 0; i < 88; ++i)
			_allKey[i].SetId(i);
	}

	void Update()
	{
		if (g_input->KeyDown(KeyCode::Q))
		{
			//g_midi->Play()
		}
	}

	void Render()
	{
		g_gfx->SetCoor(nullptr);
		g_gfx->SetColor(createColor(0x777777ff));
		g_gfx->SetOrder(ORDER_BG);
		g_gfx->RectangleSolid2D({}, toPosition(g_system->GetWindowSize()));
		g_gfx->SetCoor(g_Game->GetPianoKeyCoor());

		for(auto& iter : _allKey)
			iter.Render();
	}
private:
	std::vector<UIPianoKey> _allKey;
};